package com.itheima.demo4genericity;

import java.util.ArrayList;

//通配符
public class geericityDemo2 {
    public static void main(String[] args) {
        ArrayList<xiaomi> list= new ArrayList<>();
        list.add(new xiaomi());
        list.add(new xiaomi());
        list.add(new xiaomi());
        go( list);
        ArrayList<BYD>list2= new ArrayList<>();
        list2.add(new BYD());
        list2.add(new BYD());
        list2.add(new BYD());
        go( list2);
    }
    //? 表示任意类型 ?extend car 表示只能接受继承car或car的子类
    //？super car 表示只能接受car类或car的父类
    public static void go(ArrayList<?> list)
    {
        for(int i=0;i<list.size();i++)
        {
            System.out.println(list.get(i));
        }
    }
}
